package MapUtils;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;

import com.amap.api.maps2d.AMap;
import com.amap.api.maps2d.model.BitmapDescriptorFactory;
import com.amap.api.maps2d.model.LatLng;
import com.amap.api.maps2d.model.Marker;
import com.amap.api.maps2d.model.MarkerOptions;
import com.example.zelonghu.testgps.R;

/**
 * @author zelonghu QQ:1032006226
 * @name testGPS2
 * @class name：MapUtils
 * @class describe
 * @time 2019/6/26 1:18 PM
 * @change
 * @chang time
 * @class 用于操控和显示不同的符号
 */
public class MapUtils {
    /**
     * @author zelonghu
     * @time 2019/6/26  1:39 PM
     * @param map AMap对象
     * @param context 上下文对象
     * @param latitude 纬度latitude
     * @param longtitude  经度longitude
     * @param title Marker名称
     * @param snippet Merker介绍
     * @describe 绘制出一个小图书馆图标
     */
    public  static void  drawLibrary(AMap map, double latitude, double longtitude, Activity context,String title,String snippet){
        LatLng nowPos = new LatLng(latitude, longtitude);
        Marker marker = map.addMarker(new MarkerOptions().position(nowPos).title(title).snippet(snippet));
        Bitmap bmp= BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_book);
        marker.setIcon(BitmapDescriptorFactory.fromBitmap(bmp));
        View markerView = context.getLayoutInflater().inflate(R.layout.library_markerlayout,null);
        marker.setIcon(BitmapDescriptorFactory.fromView(markerView));
    }
    /**
     * @author zelonghu
     * @time 2019/6/26  1:39 PM
     * @param map AMap对象
     * @param context 上下文对象
     * @param latitude 纬度latitude
     * @param longtitude  经度longitude
     * @param title Marker名称
     * @param snippet Merker介绍
     * @describe 绘制出一个小衣服图标
     */
    public  static void  drawClothes(AMap map, double latitude, double longtitude, Activity context, String title, String snippet){
        LatLng nowPos = new LatLng(latitude, longtitude);
        Marker marker = map.addMarker(new MarkerOptions().position(nowPos).title(title).snippet(snippet));
        View markerView = context.getLayoutInflater().inflate(R.layout.clothes_markerlayout,null);
        marker.setIcon(BitmapDescriptorFactory.fromView(markerView));
    }

    /**
     * @author zelonghu
     * @time 2019/7/3  8:45 AM
     * @param map AMap对象
     *      * @param context 上下文对象
     *      * @param latitude 纬度latitude
     *      * @param longtitude  经度longitude
     *      * @param title Marker名称
     *      * @param snippet Merker介绍
     * @describe 绘制出一个🐱
     */
    public static void deawCatWitness(AMap map,double latitude,double longtitude ,Activity context,String title,String snippet){
        LatLng nowPos = new LatLng(latitude, longtitude);
        Marker marker = map.addMarker(new MarkerOptions().position(nowPos).title(title).snippet(snippet));
        View markerView = context.getLayoutInflater().inflate(R.layout.cat_markerlayout,null);
        marker.setIcon(BitmapDescriptorFactory.fromView(markerView));

    }
}
